package pres.dnf.test.java.springcloud.client.hystrix.ribbon.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pres.dnf.test.java.springcloud.client.hystrix.ribbon.service.OpsConsumerService;

import java.util.List;

/**
 * @author dengfan
 * @version 1.0
 * @description
 * @date 2018/9/11 0011 16:49
 */
@RestController
public class OpsConsumerAPI {

    @Autowired
    private OpsConsumerService opsConsumerService;

    @Autowired
    private DiscoveryClient discoveryClient;

    @RequestMapping(value = "/add")
    public String add(){
        return opsConsumerService.add();
    }

    @RequestMapping(value = "/plus")
    public String plus(){
        return "not impl";
    }

    @RequestMapping(value="/serivces")
    public List<String> listServices(){
        return discoveryClient.getServices();

    }
}
